package com.hkts.management.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hkts.management.common.utils.CustomPage;

public class CustomPageUtils<T> {
    public static  <T> CustomPage getCustomPage(IPage page){
        CustomPage  customPage=new  CustomPage();
        customPage.setPageNumber(page.getCurrent());
        customPage.setPageSize(page.getSize());
        customPage.setTotalPages(page.getPages());
        customPage.setTotalRows(page.getTotal());
        customPage.setResultData(page.getRecords());
        return customPage;
    }
    public static Page getPage(CustomPage customPage){
        return new Page(customPage.getPageNumber(),customPage.getPageSize());
    }
}
